<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--jstl을 쓰기 위해 사용 --%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><%--숫자 포맷을 사용하기 위해 사용 --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"  prefix="fn"%><%--함수들을 이용하기 위해 사용 --%>
<%@ taglib prefix="c-rt" uri="http://java.sun.com/jstl/core_rt" %>  <%-- ie버전 확인에 쓰기 위해 씀 --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>취약성 식별 생성</title>
<script type="text/javascript" src="script/sms_riskI_script.js"></script>
<script type="text/javascript" src="script/sms_util_script.js"></script>
<script type="text/javascript">
//모든 체크 박스 선택 & 해제
function selectAll2(){
	 var checkAll1=document.getElementsByName("checkAll1")[0];
	 var check1;
	  if(checkAll1.checked)
	   check1=true;
	  else
	   check1=false;

	 var objElements1 = document.getElementsByName("check1");
	 var chboxSize1=objElements1.length;
	 

	 if(objElements1 == null){
	 
	  return;
	 }else if(chboxSize1<1)

	 {
	  alert("체크 가능한 목록이 없습니다.");
	 }else{
	 
	 
	   for(var i = 0; i<chboxSize1;i++)
	   {
	    objElements1[i].checked=check1;
	   }
	 }
	 //var checkAll2=document.getElementsByName("checkAll2")[0];
	 //var checkAll3=document.getElementsByName("checkAll3")[0];
	 var check2;
	  if(checkAll1.checked){
	   check2=true;
	  //checkAll2.checked=true;
	  //checkAll3.checked=true;
	  }
	  else{
	   check2=false;
	   //checkAll2.checked=false;
	   //checkAll3.checked=false;
	  }

	 var objElements2 = document.getElementsByName("check2");
	 var chboxSize2=objElements2.length;
	 

	 if(objElements2 == null){
	 
	  return;
	 }else if(chboxSize2<1)

	 {
	  alert("체크 가능한 목록이 없습니다.");
	 }else{
	 
	 
	   for(var i = 0; i<chboxSize2;i++)
	   {
	    objElements2[i].checked=check2;
	   }
	 }
	 ///
	 var check3;
	  if(checkAll1.checked)
	   check3=true;
	  else
	   check3=false;

	 var objElements3 = document.getElementsByName("check3");
	 var chboxSize3=objElements3.length;
	 

	 if(objElements3 == null){
	 
	  return;
	 }else if(chboxSize3<1)

	 {
	  alert("체크 가능한 목록이 없습니다.");
	 }else{
	 
	 
	   for(var i = 0; i<chboxSize3;i++)
	   {
	    objElements3[i].checked=check3;
	   }
	 }
	///
	 var check4;
	  if(checkAll1.checked)
	   check4=true;
	  else
	   check4=false;

	 var objElements4 = document.getElementsByName("check4");
	 var chboxSize4=objElements4.length;
	 

	 if(objElements4 == null){
	 
	  return;
	 }else if(chboxSize4<1)

	 {
	  alert("체크 가능한 목록이 없습니다.");
	 }else{
	 
	 
	   for(var i = 0; i<chboxSize4;i++)
	   {
	    objElements4[i].checked=check4;
	   }
	 }
}

/*
function selectAll2(){
	 var checkAll2=document.getElementsByName("checkAll2")[0];
	 var checkAll3=document.getElementsByName("checkAll3")[0];
	 var check2;
	  if(checkAll2.checked){
	   check2=true;
	  checkAll3.checked=true;
	  }
	  else{
	   check2=false;
	  checkAll3.checked=false;
	  }

	 var objElements2 = document.getElementsByName("check2");
	 var chboxSize2=objElements2.length;
	 

	 if(objElements2 == null){
	 
	  return;
	 }else if(chboxSize2<1)

	 {
	  alert("체크 가능한 목록이 없습니다.");
	 }else{
	 
	 
	   for(var i = 0; i<chboxSize2;i++)
	   {
	    objElements2[i].checked=check2;
	   }
	 }
	 var check3;
	  if(checkAll2.checked)
	   check3=true;
	  else
	   check3=false;

	 var objElements3 = document.getElementsByName("check3");
	 var chboxSize3=objElements3.length;
	 

	 if(objElements3 == null){
	 
	  return;
	 }else if(chboxSize3<1)

	 {
	  alert("체크 가능한 목록이 없습니다.");
	 }else{
	 
	 
	   for(var i = 0; i<chboxSize3;i++)
	   {
	    objElements3[i].checked=check3;
	   }
	 }
}
function selectAll3(){
	 var checkAll3=document.getElementsByName("checkAll3")[0];
	 var check3;
	  if(checkAll3.checked)
	   check3=true;
	  else
	   check3=false;

	 var objElements3 = document.getElementsByName("check3");
	 var chboxSize3=objElements3.length;
	 

	 if(objElements3 == null){
	 
	  return;
	 }else if(chboxSize3<1)

	 {
	  alert("체크 가능한 목록이 없습니다.");
	 }else{
	 
	 
	   for(var i = 0; i<chboxSize3;i++)
	   {
	    objElements3[i].checked=check3;
	   }
	 }
}
*/
</script>
<link href="reset.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<!--말 줄임 css(모든 브라우저 적용)-->
<style type="text/css">
.ellipsis{
	white-space:nowrap;
	text-overflow:ellipsis;		/* IE, Safari */
	-o-text-overflow:ellipsis;		/* Opera under 10.7 */
	overflow:hidden;			/* "overflow" value must be different from "visible" */ 
	-moz-binding: url('ellipsis.xml#ellipsis');
}
</style>


<script type="text/javascript">
function winClose(){
	window.close();
}
</script>
</head>
<body>
<c:if test="${sessionScope.USER_ID==null}">
		<script type="text/javascript">
			alert("연결이 끊어졌습니다. 다시 로그인 해주시기 바랍니다");
			window.close();
		</script>	
</c:if>
<div class="box">
      		<h4 class="white">
      			<span class="align-left">취약성 식별 생성</span>
	      		<span class="align-right">마감상태(위험식별) :
		      		<c:choose>
		      			<c:when test="${sessionScope.magamSession[2].state =='Y'}">
		      				 마감
		      			</c:when>
		      			<c:otherwise>
		      				 착수
		      			</c:otherwise>
		      		</c:choose>
	      		</span>
      		</h4>
        <div class="box-container1">     		
		 <form action="riskIAction.do" method="post" name="mvlist">
			<input type="hidden" name="mode" value="mvlist_insert"></input>
			<input type="hidden" name="pro_id" id="pro_id" value="${sessionScope.lastProId }"></input>
			<table class="table-long" style="margin: 0 auto;">
			<colgroup>
				<col width="110px"/>
				<col/>
			</colgroup>
      			<thead>
      				<tr>
      					<td class="col-alignCenter">
      						통제구분 
      					</td>
      					<td class="noBGC">
      						<select name="ts_cd1" id="ts_cd1" class="selectBox" onchange="search_ts_cd('1')" style="width: 300px;">
      							<option value="0"> - 전체 - </option>
								<c:forEach  var="list" items="${requestScope.distinctList1}" varStatus="status">
									<option <c:if test="${list.ts_cd1 == requestScope.ts_cd1 }">selected</c:if> value="${list.ts_cd1 }">${list.ts_nm1 }</option>
								</c:forEach>
							</select>
      					</td>
      				</tr>
      				<tr>
      					<td class="col-alignCenter">
      						통제영역 
      					</td>
      					<td class="noBGC">
      						<select name="ts_cd2" id="ts_cd2" class="selectBox" onchange="search_ts_cd('2')" style="width: 300px">
      							<option value="0"> - 전체 - </option>
								<c:forEach  var="list" items="${requestScope.distinctList2}" varStatus="status">
									<option <c:if test="${list.ts_cd2 == requestScope.ts_cd2 }">selected</c:if> value="${list.ts_cd2 }">${list.ts_nm2 }</option>
								</c:forEach>
							</select>
      					</td>
      				</tr>
      				<tr>
      					<td class="col-alignCenter">
      						통제항목 
      					</td>
      					<td class="noBGC">
      						<select name="ts_cd3" id="ts_cd3" class="selectBox" onchange="search_ts_cd('3')" style="width: 300px">
      							<option value="0"> - 전체 - </option>
								<c:forEach  var="list" items="${requestScope.distinctList3}" varStatus="status">
									<option <c:if test="${list.ts_cd3 == requestScope.ts_cd3 }">selected</c:if> value="${list.ts_cd3 }">${list.ts_nm3 }</option>
								</c:forEach>
							</select>
      					</td>
      				</tr>
      			</thead>
      		</table>
        	<table class="table-long" style="margin: 0 auto;">
      			<tfoot>
      				<tr>
      					<td>
	      					<div class="align-right">
		                     	
		                     	<c:choose>
	                       		<c:when test="${sessionScope.magamSession[2].state !='Y'}">
	                       		<!-- 마감 현황이 유무 판별(Y 시 입력 불가) -->
	                       			<a href="#" class="button" onclick="javascript: mvlistInsert()"><span>저장</span></a>
	                       		</c:when>
	                       		<c:otherwise>
	                       			<a href="#" class="button1 addMargin" onclick="return false;"><span>저장</span></a>
	                       		</c:otherwise>
	                       	</c:choose>
		                     	 <a href="#" class="button" onclick="javascript: winClose()"><span>닫기</span></a>
	                     	</div>
      					</td>
      				</tr>
      				<tr><td class="spaceLine"></td></tr>
      			</tfoot>
      		</table>
      		<table class="table-long" style="margin: 0 auto;">
      			<colgroup>
					<col width="35px"/>
					<col width="70px"/>
					<col width="30px"/>
					<col width="120px"/>
					<col width="30px"/>
					<col width="120px"/>
					<col width="30px"/>
					<col width="160px"/>
					<col/>
					<col width="15px"/>
				</colgroup>
      			<thead>
      				<tr>
      					<td class="col-rowspanMid col-alignCenter">
      						<input type='checkbox' name='checkAll1' onclick="javascript: selectAll2()" class="chkCursor" checked="checked"></input>
      					</td>
      					<td>통제구분</td>
      					<td>
      						<%--<input type='checkbox' name='checkAll2' onclick="javascript: selectAll2()" style="cursor:pointer"></input> --%>
      					</td>
      					<td>통제영역</td>
      					<td>
      						<%--<input type='checkbox' name='checkAll3' onclick="javascript: selectAll3()" style="cursor:pointer"></input> --%>
      					</td>
      					<td>통제항목</td>
      					<td>
      						<%--<input type='checkbox' name='checkAll4' onclick="javascript: selectAll4()" style="cursor:pointer"></input> --%>
      					</td>
      					<td>통제 세부항목</td>
      					<td>취약성명</td>
      					<td rowspan="2"></td>
      				</tr>
      			</thead>
      		</table>
      		<div class="scrollDIV" style="height: 335px;">
      		<table class="table-long" style="margin: 0 auto;">
      			<colgroup>
					<col width="35px"/>
					<col width="70px"/>
					<col width="30px"/>
					<col width="120px"/>
					<col width="30px"/>
					<col width="120px"/>
					<col width="30px"/>
					<col width="160px"/>
					<col/>
					<col width="15px"/>
				</colgroup>
      			<tbody>
      				<c:choose>
                    	<c:when test="${fn:length(list)!= 0}">
                       	<c:forEach var="list" items="${requestScope.list}" varStatus="status">
	                    			<%--
	                    			<tr onmouseover="ChangeBackground(this,'over','${status.index}');" onmouseout="ChangeBackground(this,'out','${status.index}');" class="odd">
	                    			 --%>
	                    	 <tr <c:if test="${status.index%2==0 }">class="odd"</c:if> onmouseover="ChangeBackground(this,'over','${status.index}');" onmouseout="ChangeBackground(this,'out','${status.index}');">
                    			<td class="col-rowspanMid col-alignCenter"><input type="checkbox" class="chkCursor" name="check1" id="${list.ts_cd1}${list.ts_cd2}${list.ts_cd3}${list.ts_cd4}"  value='${list.ts_cd1}|${list.ts_cd2}|${list.ts_cd3}|${list.ts_cd4}' onclick="checkeds(this,1)" checked="checked"></input></td>
                    			<td>
                    				<div class="ellipsis"  style="width:100%;" title="${list.ts_nm1}">${list.ts_nm1 }</div>
                    			</td>
                    			<td class="col-rowspanMid"><input type="checkbox" class="chkCursor" name="check2" id="${list.ts_cd1}${list.ts_cd2}${list.ts_cd3}${list.ts_cd4}"  value='${list.ts_cd1}|${list.ts_cd2}|${list.ts_cd3}|${list.ts_cd4}' onclick="checkeds(this,2)" checked="checked"></input></td>
                    			<td>
                    				<div class="ellipsis"  style="width:100%;" title="${list.ts_nm2}">${list.ts_nm2 }</div>
                    			</td>
                    			<td class="col-rowspanMid"><input type="checkbox" class="chkCursor" name="check3" id="${list.ts_cd1}${list.ts_cd2}${list.ts_cd3}${list.ts_cd4}"  value='${list.ts_cd1}|${list.ts_cd2}|${list.ts_cd3}|${list.ts_cd4}' onclick="checkeds(this,3)" checked="checked"></input></td>
                    			<td>
                    				<div class="ellipsis" style="width:100%;" title="${list.ts_nm3 }">${list.ts_nm3 }</div>
                    			</td>
                    			<td class="col-rowspanMid"><input type="checkbox" class="chkCursor" name="check4" id="${list.ts_cd1}${list.ts_cd2}${list.ts_cd3}${list.ts_cd4}"  value='${list.ts_cd1}|${list.ts_cd2}|${list.ts_cd3}|${list.ts_cd4}' onclick="checkeds(this,4)" checked="checked"></input></td>
                    			<td>
                    				<div class="ellipsis" style="width:100%;" title="${list.ts_nm4 }">${list.ts_nm4 }</div>
                    			</td>
                    			<td>
                    				<div class="ellipsis" style="width:100%;" title="${list.v_nm }">${list.v_nm }</div>
                    			</td>
	   					 	<td></td>
                    		</tr>
                    	</c:forEach>
                    	</c:when>
                    	<c:otherwise>
                    		<tr class="odd">
								<td colspan="10"  class="noDataTD">-데이터가 없습니다-</td>
							</tr>
                    	</c:otherwise>
                    	</c:choose>
      			</tbody>
      		</table>
      		</div>
      		</form>
      	</div><!-- end of div.box-container1 -->
      	</div> <!-- end of div.box -->
</body>
</html>